package cn.com.dcsgo.springcloudstudy.order.controller;

import cn.com.dcsgo.springcloudstudy.commons.pojo.CommonResult;
import cn.com.dcsgo.springcloudstudy.commons.pojo.Payment;
import cn.com.dcsgo.springcloudstudy.order.service.PaymentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Dcsgo
 * @since 2024-08-03
 */
@Slf4j
@RestController
public class OrderFeignController {
    @Autowired
    private PaymentService paymentService;

    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<? extends Payment> getPaymentById(@PathVariable("id") Long id) {
        return paymentService.queryById(id);
    }

    @GetMapping("/consumer/feign/timeout")
    public String PaymentFeignTimeOut() throws InterruptedException {
        return paymentService.paymentFeignTimeout();
    }
}
